Core.Test.registerTest({
	group: "utils",
	name: "Object.set()",
	
	before: function() {
		this.object = {
			primitive: 10,
			object: {primitiveA: "string", primitiveB: true}
		};
	},
	
	set: function(path, value) {
		return Object.set(this.object, path, value);
	},
	
	"Should set primitive into existing String path": function() {
		this.set(["object", "primitiveA"], "new");
		Assert.equal("new", this.object.object.primitiveA);
	},
	
	"Should set object into existing path": function() {
		this.set(["object"], {keyA: "new"});
		Assert.equal({keyA: "new"},this.object.object);
	},
	
	"Should set primitive into new path": function() {
		this.set(["create", "path"], 21 );
		Assert.equal({path: 21}, this.object.create);
	},
	
	"Should set and modify standalone array": function() {
		var arr = ["a", "aa", "aaa"];
		Object.set(arr, ["1"], "bb");
		
		Assert.equal(["a", "bb", "aaa"], arr);
	},
	
	"Should set and modify array inside the object": function() {
		var obj = {arr: ["a", "aa", "aaa"]};
		Object.set(obj, ["arr", "1"], "bb");
		
		Assert.equal(["a", "bb", "aaa"], obj.arr);
	}
});